Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #100: Add purge support #104

Merged
merged 3 commits into from
Jul 5, 2020
Merged

Conversation

hdpoliveira
Copy link
Collaborator

The code does not check if the extension is enabled.
Instead it shows an error when tried to run the command and the extension is missing.

Copy link
Collaborator

@incidentist incidentist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think displaying this as a "discard" feature will result in accidentally deleted files. See inline comments.

@@ -23,6 +23,9 @@
"command.update": "Update to...",
"command.branch": "Create Branch...",
"command.pull": "Pull",
"command.purge": "Purge",
"command.purgeFiles": "Purge All Untracked Files",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between "Purge" and "Purge All Untracked Files"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purge is for the individual file, and Purge all untracked is for the whole untracked files source group.
This allow the user to have a fine grain control on the Untracked Source Group view.

package.json Outdated
"command": "hg.purgeFiles",
"title": "%command.purgeFiles%",
"category": "Hg",
"icon": "$(discard)"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

purge is very different from discarding changes. If I saw this in the hg extension, I would assume it discards changes, and would be frustrated if it deleted my untracked files. This should not use the discard icon, because that icon implies reverting changes rather than deleting files. I don't think this command is used frequently enough to warrant a top-level icon in the SCM pane. It should just be a command in the command palette.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The git extension uses the discard icon for untracked files, and it is really useful to be able to purge the files from the SCM view.
The tool also asks the user for confirmation, informing this is irreversible.

Also, the user has to enable purge extension for this to work, so they know what they are doing here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the git extension uses the discard icon because it doesn't have a separate group for Untracked files, so it has to be consistent with the other files.

In our case we should use the trash icon instead. I believe this will be informing enough to the user that this action deletes files.

Icon reference: https://code.visualstudio.com/api/references/icons-in-labels


@command('hg.purge')
async purge(...resourceStates: SourceControlResourceState[]): Promise<void> {
if (resourceStates.length === 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should there be an option to purge specific files? Selecting specific files to send to the purge command is the same thing as selecting specific files and then deleting them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. Currently there is no way of deleting untracked files from the SCM tab, so this is what I am implementing.

@hdpoliveira
Copy link
Collaborator Author

purge

@mrcrowl
Copy link
Owner

mrcrowl commented Jul 4, 2020

Thanks for the demo. Looks great.

@incidentist
Copy link
Collaborator

Thanks for making these changes. I saw after I made the notes that the git extension does indeed use the discard icon. This is better, though. :)

@incidentist incidentist linked an issue Jul 5, 2020 that may be closed by this pull request
@incidentist incidentist merged commit 19a6d15 into mrcrowl:master Jul 5, 2020
@hdpoliveira
Copy link
Collaborator Author

Yeah, it does look better with the trash icon, and I wouldn't have found it without your review! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automated Unit/Integration Tests
3 participants